//
//  ByApiOther.m
//  caipiao_ios
//
//  Created by mc on 2018/7/17.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByApiOther.h"

@implementation ByApiOther

/** 首页信息 */
+ (void)indexSuccess:(void(^)(ByNetBaseResult *result))success
             failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    [self get:@"/Index/index?" params:nil success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"更新成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
        
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
        
    }];
    
}

//投注记录
+ (void)betRecoreList:(ByNetModel *)model
              success:(void(^)(ByNetBaseResult *result))success
              failure:(void(^)(ByNetBaseResult *result))failure{
    
 
    [self get:[NSString stringWithFormat:@"/BettingLog/bet_list?key=%@",model.key] params:nil success:^(id result) {
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
    }];
    
}


//APP配置信息查询
+ (void)configAppSuccess:(void(^)(ByNetBaseResult *result))success
                 failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    [self get:[NSString stringWithFormat:@"/Config/index?"] params:nil success:^(id result) {
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
    }];
    
    
}


//数字彩投注详情
+ (void)betRecoreListInfo:(ByNetModel *)model
                  success:(void(^)(ByNetBaseResult *result))success
                  failure:(void(^)(ByNetBaseResult *result))failure{
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    
    [self get:[NSString stringWithFormat:@"/BettingLog/bet_list_info?id=%@",model.ID] params:nil success:^(id result) {
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
    }];
}


//竞彩详情
+(void)betLogSportsDetail:(ByNetModel *)model
                  success:(void(^)(ByNetBaseResult *result))success
                  failure:(void(^)(ByNetBaseResult *result))failure{
    
    [self get:[NSString stringWithFormat:@"/BettingLog/sports_detail?id=%@",model.ID] params:nil success:^(id result) {
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
    }];
}


+(void)feedback:(ByNetModel *)model
        success:(void(^)(ByNetBaseResult *result))success
        failure:(void(^)(ByNetBaseResult *result))failure{
    
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    if (model.content){
        [params setObject:model.content forKey:@"content"];
    }
    
    
    [self post:@"/feedback/feedback" params:params success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
}

//消息查询接口
+ (void)messageQuery:(ByNetModel *)model
             success:(void(^)(ByNetBaseResult *result))success
             failure:(void(^)(ByNetBaseResult *result))failure{
    
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    if (model.read_status){
        [params setObject:model.read_status forKey:@"read_status"];
    }
    
    
    [self post:@"/message/query" params:params success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
}


//获取可用的支付方式
+ (void)paySupportSuccess:(void(^)(ByNetBaseResult *result))success
                  failure:(void(^)(ByNetBaseResult *result))failure{
    
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    [self post:@"/pay/support" params:params success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
}

//开奖公告
+ (void)drawNoticeSuccess:(void(^)(ByNetBaseResult *result))success
                  failure:(void(^)(ByNetBaseResult *result))failure{
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    [self post:@"/DrawNotice/notice" params:params success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
}


//开奖公告详情
+ (void)drawNoticeDetail:(ByNetModel *)model
                 success:(void(^)(ByNetBaseResult *result))success
                 failure:(void(^)(ByNetBaseResult *result))failure{
    
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    if (model.ID) {
        [params setObject:model.ID forKey:@"id"];
    }
    [self post:@"/DrawNotice/detail" params:params success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
    
}


//竞彩开奖详情
+ (void)drawNoticeBallInfo:(ByNetModel *)model
                   success:(void(^)(ByNetBaseResult *result))success
                   failure:(void(^)(ByNetBaseResult *result))failure{
    
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    [params setObject:[NSString stringWithFormat:@"%ld", model.type] forKey:@"type"];
    [self post:@"/DrawNotice/ballinfo" params:params success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
}


//追号管理
+ (void)chasingIndex:(ByNetModel *)model
             success:(void(^)(ByNetBaseResult *result))success
             failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    [self post:@"/Chasing/index" params:nil success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
}

//追号详情
+ (void)chasingInfo:(ByNetModel *)model
            success:(void(^)(ByNetBaseResult *result))success
            failure:(void(^)(ByNetBaseResult *result))failure{
    
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    if (model.ID) {
        [params setObject:model.ID forKey:@"id"];
    }
    [self post:@"/Chasing/info" params:params success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
}


//查看自己的推荐码
+ (void)invitationCodeIndexSuccess:(void(^)(ByNetBaseResult *result))success
                           failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    [self get:[NSString stringWithFormat:@"/InvitationCode/index"] params:nil success:^(id result) {
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
    }];
    
}


@end
